package itheima.d06;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.TreeSet;

public class Test {
    public static void main(String[] args) {
        ArrayList<Student> set = new ArrayList<>();
        Student s1 = new Student("小红", 20, "女",80);
        Student s2 = new Student("小王", 17, "男",100);
        Student s3 = new Student("小华", 20, "男",90);
        set.add(s1);
        set.add(s2);
        set.add(s3);


        Iterator<Student> it = set.iterator();

       while (it.hasNext()){
           Student s = it.next();
           if (s.getName().equals("小王")){
               it.remove();
           }
       }

        System.out.println("");
       set.forEach(System.out::println);

    }

}
